/*
 * F100.c
 *
 *  Created on: 21/10/2012
 *      Author: Sarah
 */

#include "F10.h"

double F10minX = -5;
double F10maxX = 5;
int F10dimensions = 1000;

int nonSeparableGroupSize = 50;

double compute(double*x) {
	int i, k;
	double result = 0.0;

	double* F10Ovector = createShiftVector(F10dimensions, F10minX, F10maxX);
	int* Pvector = createPermVector(F10dimensions);
	double * RotMatrix = createRotMatrix1D(nonSeparableGroupSize);

	double* F10anotherz = malloc(sizeof(double) * F10dimensions);

	for (i = 0; i < F10dimensions; i++) {
		F10anotherz[i] = x[i] - F10Ovector[i];
	}
	for (k = 1; k <= F10dimensions / (2 * nonSeparableGroupSize); k++) {
		result += rot_rastrigin2(F10anotherz, nonSeparableGroupSize, k);
	}


	result += rastrigin2(F10anotherz, F10dimensions, 2);

	free(F10Ovector);
	free(F10anotherz);
	free(RotMatrix);
	free(Pvector);
	return (result);
}

int F10GetF10dimensionss() {
	return F10dimensions;
}
double F10GetGetMax() {
	return F10maxX;
}
double F10GetMin() {
	return F10minX;
}
